package zhoug.common.compat;

import android.os.Bundle;
import android.os.IBinder;
import android.os.Parcelable;
import android.util.Size;
import android.util.SizeF;
import android.util.SparseArray;

import java.io.Serializable;
import java.util.ArrayList;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

/**
 * @Author: zhoug
 * @Date: 2025-02-13
 * @Description:
 */
public interface IBundle {
    Bundle getData();

    IBundle putInt(@Nullable String key, int value);

    IBundle putLong(@Nullable String key, long value);

    IBundle putShort(@Nullable String key, short value);

    IBundle putByte(@Nullable String key, byte value);

    IBundle putChar(@Nullable String key, char value);

    IBundle putFloat(@Nullable String key, float value);

    IBundle putDouble(@Nullable String key, double value);

    IBundle putBoolean(@Nullable String key, boolean value);

    IBundle putString(@Nullable String key, String value);


    IBundle putCharSequence(@Nullable String key, @Nullable CharSequence value);

    IBundle putParcelable(@Nullable String key, @Nullable Parcelable value);

    IBundle putSize(@Nullable String key, @Nullable Size value);

    IBundle putSizeF(@Nullable String key, @Nullable SizeF value);

    IBundle putParcelableArray(@Nullable String key, @Nullable Parcelable[] value);

    IBundle putParcelableArrayList(@Nullable String key,
                                   @Nullable ArrayList<? extends Parcelable> value);


    IBundle putSparseParcelableArray(@Nullable String key,
                                     @Nullable SparseArray<? extends Parcelable> value);

    IBundle putIntegerArrayList(@Nullable String key, @Nullable ArrayList<Integer> value);

    IBundle putStringArrayList(@Nullable String key, @Nullable ArrayList<String> value);

    IBundle putCharSequenceArrayList(@Nullable String key,
                                     @Nullable ArrayList<CharSequence> value);

    IBundle putSerializable(@Nullable String key, @Nullable Serializable value);

    IBundle putSerializableArrayList(@Nullable String key, @Nullable ArrayList<? extends Serializable> value);

    IBundle putByteArray(@Nullable String key, @Nullable byte[] value);

    IBundle putShortArray(@Nullable String key, @Nullable short[] value);

    IBundle putCharArray(@Nullable String key, @Nullable char[] value);

    IBundle putFloatArray(@Nullable String key, @Nullable float[] value);

    IBundle putCharSequenceArray(@Nullable String key, @Nullable CharSequence[] value);

    IBundle putBundle(@Nullable String key, @Nullable Bundle value);

    IBundle putBinder(@Nullable String key, @Nullable IBinder value);


    int getInt(String key);

    int getInt(String key, int defaultValue);

    long getLong(String key);

    long getLong(String key, long defaultValue);

    short getShort(String key);

    short getShort(String key, short defaultValue);


    byte getByte(String key);

    Byte getByte(String key, byte defaultValue);

    char getChar(String key);

    char getChar(String key, char defaultValue);


    float getFloat(String key);

    float getFloat(String key, float defaultValue);

    double getDouble(String key);

    double getDouble(String key, double defaultValue);

    boolean getBoolean(String key);

    boolean getBoolean(String key, boolean defaultValue);

    String getString(String key);

    String getString(String key, String defaultValue);


    @Nullable
    CharSequence getCharSequence(@Nullable String key);

    CharSequence getCharSequence(@Nullable String key, CharSequence defaultValue);

    @Nullable
    Size getSize(@Nullable String key);

    @Nullable
    SizeF getSizeF(@Nullable String key);

    @Nullable
    Bundle getBundle(@Nullable String key);


    @Nullable
    <T extends Parcelable> T getParcelable(@Nullable String key);

    @Nullable
    <T> T getParcelable(@Nullable String key, @NonNull Class<T> clazz);


    @Nullable
    Parcelable[] getParcelableArray(@Nullable String key);

    @Nullable
    <T> T[] getParcelableArray(@Nullable String key, @NonNull Class<T> clazz);


    @Nullable
    <T extends Parcelable> ArrayList<T> getParcelableArrayList(@Nullable String key);

    @Nullable
    <T> ArrayList<T> getParcelableArrayList(@Nullable String key,
                                            @NonNull Class<? extends T> clazz);


    @Nullable
    <T extends Parcelable> SparseArray<T> getSparseParcelableArray(@Nullable String key);

    @Nullable
    <T> SparseArray<T> getSparseParcelableArray(@Nullable String key,
                                                @NonNull Class<? extends T> clazz);


    @Nullable
    Serializable getSerializable(@Nullable String key);

    @Nullable
    <T extends Serializable> T getSerializable(@Nullable String key,
                                               @NonNull Class<T> clazz);

    @Nullable
    <T extends Serializable> ArrayList<T> getSerializableArrayList(@Nullable String key, @NonNull Class<T> clazz);

    @Nullable
    ArrayList<Integer> getIntegerArrayList(@Nullable String key);

    @Nullable
    ArrayList<String> getStringArrayList(@Nullable String key);

    @Nullable
    ArrayList<CharSequence> getCharSequenceArrayList(@Nullable String key);

    @Nullable
    byte[] getByteArray(@Nullable String key);

    @Nullable
    short[] getShortArray(@Nullable String key);

    @Nullable
    char[] getCharArray(@Nullable String key);

    @Nullable
    float[] getFloatArray(@Nullable String key);

    @Nullable
    CharSequence[] getCharSequenceArray(@Nullable String key);

    @Nullable
    IBinder getBinder(@Nullable String key);

}
